package com.ethan.minimalist.ui.video

import android.os.Bundle
import android.view.View
import com.cxz.kotlin.baselibs.base.BaseFragment
import com.ethan.minimalist.R
import com.ethan.minimalist.base.AgentWebFragment

/**
 *@author ethan_
 *date 2020/3/15 20:33
 *desc:
 */
class VideoFragment :BaseFragment() {

    private var mAgentWebFragment: AgentWebFragment? = null

    override fun attachLayoutRes(): Int {
        return R.layout.fragment_video
    }

    override fun initView(view: View) {
        val beginTransaction = childFragmentManager.beginTransaction()
        var mBundle = Bundle()
        beginTransaction.add(R.id.fl_container,
            AgentWebFragment.getInstance(Bundle().also { mBundle = it }).also {
                mAgentWebFragment = it
            },
            AgentWebFragment::class.java.name
        )
        mBundle.putString(AgentWebFragment.URL_KEY, "https://haokan.baidu.com/")
        beginTransaction.commitAllowingStateLoss()
    }

    override fun lazyLoad() {

    }

    companion object {
        fun getInstance(title: String): VideoFragment {
            val fragment = VideoFragment()
            val bundle = Bundle()
            fragment.arguments = bundle
            return fragment
        }
    }
}